﻿var dhxWins = null;
function myWindow() {
}

myWindow.createWindow = function(winId, title, winUrl, width, height) {
    this.showMask(winId);
    dhxWins = new dhtmlXWindows();
    var x = (document.body.clientWidth - parseInt(width)) / 2;
    var y = (document.body.clientHeight - parseInt(height)) / 2;
    var wd = dhxWins.createWindow(winId, x, y, parseInt(width), parseInt(height));
    wd.setText(title);
    wd.attachURL(winUrl);
    wd.button("close").attachEvent("onClick", function() {
        myWindow.closeWindow(winId);
    });

}
myWindow.closeWindow = function(winId) {
    this.hideMask(winId);
    dhxWins.window(winId).close();
}
//显示蒙层
myWindow.showMask = function(id) {
    //蒙层
    var div = document.getElementById("JXW__loading_div" + id);
    if (div == null) {
        div = document.createElement("DIV");
        document.body.appendChild(div);
        div.id = "JXW__loading_div" + id;
        div.style.position = "absolute";
        div.style.top = "0px";
        div.style.filter = "alpha(opacity=30)";
        div.style.background = "#777";
        div.style.zindex = "2";
        div.style.left = "0px";
    }

    div.style.width = document.body.clientWidth;
    div.style.height = document.body.clientHeight;
    div.style.display = "";
}
//隐藏蒙层
myWindow.hideMask = function(id) {
    var div = document.getElementById("JXW__loading_div" + id);
    if (div != null)
        div.style.display = "none";
    //document.remove("JXW__loading_div" + id);
}
